<template>
	<analyse-form
		v-if="businessType"
		:ticket-id="ticketId"
		:node-task-id="nodeTaskId"
		:business-type="businessType"
		:node-info="nodeInfo"
		:ticket-info="ticketInfo"
		@success="onSuccess"
	></analyse-form>
</template>

<script>
import AnalyseForm from '../check/components/AnalyseForm.vue'
import { getCurrentInspectDetail } from '@/api/spw/ticketInspect.js'
import { getTicketInfoById } from '@/api/spw/ticketApply.js'
export default {
	components: {
		AnalyseForm
	},
	async onLoad(option) {
		const { nodeTaskId, ticketId } = option
		this.nodeTaskId = nodeTaskId
		this.ticketId = ticketId
		const [res, ticketRes] = await Promise.all([getCurrentInspectDetail(nodeTaskId), getTicketInfoById(ticketId)])
		this.nodeInfo = res.data
		this.ticketInfo = ticketRes.data
	},
	computed: {
		businessType() {
			return this.ticketInfo.workTypeFlag
		}
	},
	data() {
		return {
			nodeTaskId: 0,
			ticketId: 0,
			nodeInfo: {},
			ticketInfo: {}
		}
	}
}
</script>
